import { sm2 } from 'sm-crypto-v2';
import { VerifyPwdOptInput } from './dto/VerifyPwdOptInput';
import { VerifyPwdOptOutput } from './dto/VerifyPwdOptOutput';
import { axiosGet, axiosPost } from '/@/api/RequestBase';
export type {
  VerifyPwdOptInput,
  VerifyPwdOptOutput,
}
const service = 'SysAuth/'; // 要写后面的斜杠, 不要写前面的斜杠

export const SysAuthApi = {
  verifyPwdOpt: (data: VerifyPwdOptInput) => {
    // 密码做sm2加密
    const publicKey = window.__env__.VITE_SM_PUBLIC_KEY;
    const password = sm2.doEncrypt(data.password, publicKey, 1);
    const account = data.account.toLowerCase()
    return axiosPost<VerifyPwdOptOutput>(service + 'verifyPwdOpt', { ...data, account, password });
  },
}